//
//  DownloadManager.h
//  ZYYD
//
//  Created by yuzhou on 12-8-2.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ASIHTTPRequest.h"
#import "ASINetworkQueue.h"
#import "DownloadInfo.h"
#import "Reachability.h"

@interface DownloadManager : NSObject
{
    ASINetworkQueue *queue;
    Reachability *reachability;
    
    BOOL waitingForWifi;
}
+ (id)defaultManager;
//下载操作
- (void)downloadBook:(NSDictionary *)dic;
- (void)download:(NSDictionary *)dic;//内部使用
- (void)downloadNext;
- (void)cancelDownload;
- (void)cancelDownload:(NSString *)subitem_id;
- (void)redownloadWithID:(NSString *)subitem_id;
- (void)deleteDownloadInfo:(NSString *)subitem_id;
- (void)deleteBookID:(NSString *)item_id;
- (void)deleteChapterID:(NSString *)subitem_id;
- (void)save;
//下载完成状态
- (BOOL)isDownloading:(NSString *)subitem_id;
- (BOOL)isDownloaded:(NSString *)subitem_id;
- (DownloadInfo *)downloadInfoOfID:(NSString *)subitem_id;
- (int)indexOfID:(NSString *)subitem_id;
//获取集合
- (NSArray *)getDownloading;
- (NSArray *)getDownloadedID;
- (NSArray *)getDownloadedChapterByID:(NSString *)item_id;
- (NSArray *)filterWithKeyword:(NSString *)keyword;
//网络状态
- (BOOL)isConnectionEnable;
- (BOOL)isWifiEnable;
- (BOOL)isWWANEnable;
@property (nonatomic,retain) NSMutableArray *allDownload;
@property (nonatomic,retain) NSDictionary *downloadingDic;
@property (nonatomic) BOOL WWANDownloadEnable;
@end
